﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Silverlight_Client.Commands_Utils;

namespace Silverlight_Client.ViewModels
{
    public class SelectedFeedVM : IViewModelBase
    {
        #region Fields

        private String      _feedimagelink, _title;
        private ICommand    _titlecmd;
        private bool        _isfeedchecked;

        #endregion

        #region Properties

        public String   Title
        {
            get { return _title; }
            set
            {
                if (_title == value) return;
                _title = value;
                RaisePropertyChanged("Title");
            }
        }
        public Uri      FeedImage
        {
            get { return new Uri(_feedimagelink, UriKind.Relative); }
        }
        public bool     IsFeedChecked
        {
            get { return _isfeedchecked; }
            set
            {
                if (_isfeedchecked == value) return;
                _isfeedchecked = value;
                RaisePropertyChanged("IsFeedChecked");
            }
        }

        #endregion

        #region Commands

        public ICommand TitleCmd
        {
            get { return _titlecmd; }
        }

        #endregion

        #region Commands Functions

        public void TitleFunc()
        {

        }
        #endregion

        #region Functions

        private void SetImageSource(String category)
        {
            switch (category)
            {
                case "News":
                    _feedimagelink = "/Silverlight_Client;component/Images/news.png";
                    break;
                case "Blog":
                    _feedimagelink = "/Silverlight_Client;component/Images/blog.png";
                    break;
                case "Charm":
                    _feedimagelink = "/Silverlight_Client;component/Images/charm.png";
                    break;
                case "Various":
                    _feedimagelink = "/Silverlight_Client;component/Images/various.png";
                    break;
                case "Economy":
                    _feedimagelink = "/Silverlight_Client;component/Images/economy.png";
                    break;
                case "High-Tech":
                    _feedimagelink = "/Silverlight_Client;component/Images/hightech.png";
                    break;
                case "Media":
                    _feedimagelink = "/Silverlight_Client;component/Images/media.png";
                    break;
                case "Recreation":
                    _feedimagelink = "/Silverlight_Client;component/Images/recreation.png";
                    break;
                case "Sport":
                    _feedimagelink = "/Silverlight_Client;component/Images/sport.png";
                    break;
            }
        }

        #endregion

        #region Ctor
        
        public SelectedFeedVM(String title, String category)
        {
            _feedimagelink = _title = String.Empty;
            _titlecmd = new RelayCommand(TitleFunc) { IsEnabled = true };
            _isfeedchecked = false;
            SetImageSource(category);
        }

        #endregion
    }
}
